import * as d3 from "d3";
import { grad2rad } from "./functions";

export interface IScale {
    min: number
    max: number
    scaleAngel: number
    exponent?: number
}

export const defaultInitScaleSettings: IScale = {
    min: 0,
    max: 300,
    scaleAngel: -270,
    exponent: 0.9,
}

export class Scale {
    name = "string";
    scale: any = null;

    constructor(public settings: IScale = defaultInitScaleSettings) {
        this.scale = d3.scalePow([settings.min, settings.max], [0, settings.scaleAngel]).exponent(this.settings.exponent)
    }
    calc(value: number) {
        return this.scale(value);
    }
}